#ifndef __THREADPOOL_H
#define __THREADPOOL_H

#include "Thread.hpp"
#include "TaskQueue.hpp"
#include "Task.hpp"
#include <vector>
#include <memory>

using std::vector;
using std::unique_ptr;

namespace tp{

class ThreadPool{
public:
    ThreadPool(size_t,size_t);
    ~ThreadPool();
    void start();
    void stop();
    void addTask(tp::Task *);
    void doTask();

private:
   vector<unique_ptr<tp::Thread>> _threads;
   size_t _threadNum;
   tp::TaskQueue _taskQue;
   size_t _queSize;
   bool _isExit;//标志线程池是否退出
};

}//end of namespace tp

#endif

